<template>
	<view class="flex-colume-start videoDetail">
		<view class="flex-colume-start" v-if="detailModel">
			<image style="width: 750rpx; height: 500rpx;" :src="detailModel.info.thumb"></image>
			<view class="flex-colume-start" style="position: relative; width: 690rpx; align-items: flex-start;">
				<image @click="collectBtnClick()" class="collectImg" mode="aspectFit"
					:src="is_collect?'/static/arrow/collect-sel.png':'/static/arrow/collect-nor.png'"></image>
				<view style="margin-top: 30rpx; font-size: 30rpx; font-weight: 500;">{{detailModel.info.name}}</view>
				<view style="margin-top: 16rpx; font-size: 28rpx; color: rgb(150, 150, 150);">{{detailModel.info.create_time_format}}</view>
				<view style="font-size: 28rpx; margin-top: 16rpx;">{{detailModel.info.content}}</view>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	import {articleDetail,addCollect,delCollect} from '@/api/api.js'
	export default {
		data() {
			return {
				is_collect:0,
				detailModel:undefined
			}
		},
		onLoad(e){
			this._id = e.id
			this.requestList()
			
		},
		methods: {
			requestList(){
				articleDetail({id:this._id}).then(res=>{
					if (res.code == 200){
						this.detailModel = res.data
					}
				})
				
			},
	
			collectBtnClick() {
				uni.showLoading({
					mask: true
				})
				var params = {
					id: this.detailModel.id,
					type: 'article'
				}
			
				if (this.is_collect == 1) {
					delCollect(params).then(res => {
						if (res.code == 200) {
							this.requestList()
						}
						this.showSimpleMessage(res.message)
						setTimeout(res1 => {
							uni.hideLoading()
						})
			
					})
					return
				}
				addCollect(params).then(res => {
					if (res.code == 200) {
						this.requestList()
					}
					this.showSimpleMessage(res.message)
					setTimeout(res1 => {
						uni.hideLoading()
					})
			
				})
			
			
			},
			
		}
	}
</script>
<style>
	page{
		background-color: white;
	}
</style>

<style lang="scss" scoped>
	.videoDetail{
		
		.collectImg {
			position: absolute;
			right: 0rpx;
			top: 50rpx;
			width: 70rpx;
			height: 70rpx;
			box-sizing: border-box;
			padding: 15rpx;
		
		}
		.videoItem{
			padding: 30rpx 10rpx;
			width: 690rpx;
			border-bottom: 1px solid rgb(230, 230, 230);
			.leftImg{
				width: 168rpx;
				height: 168rpx;
				border-radius: 10rpx;
				flex-shrink: 0;
				margin-right: 12rpx;
			}
			.title1{
				max-width: 490rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				font-size: 28rpx;
				color: #38383A;
	
				
			}
			.desc1{
				max-width: 490rpx;
				margin-top: 12rpx;
				font-family: Source Han Sans CN;
				font-size: 25rpx;
				color: #949999;
				line-height: 32rpx;
				
			}
		}
	}

</style>
